<template>
  <el-form-item :label="label" :prop="prop">
    <component
      :is="name || 'el-input'"
      v-model="val"
      v-bind="attr || {}"
      size="mini"
    >
      <template v-if="options && name == 'el-select'">
        <el-option
          v-for="op in options"
          :key="op.value"
          :label="op.label"
          :value="op.value"
        ></el-option>
      </template>
    </component>
  </el-form-item>
</template>

<script>
export default {
  props: ["prop", "label", "name", "attr", "options", "value","extColumn"],
  data:() => ({
    val:undefined
  }),
  created(){
    this.val = this.value;
  },
  watch:{
    value(v){
      if(this.val !== v){
        this.val = v;
      }
    },  
    val(v){
      this.$emit('input',v)
    }
  }
};
</script>
